{extend name='base/form_base' /}

{block name='content'}
<div class="layui-fluid">
  <form class="layui-form" id="edit_form" onsubmit="return false">
        <input type="hidden" name="id" value="{$data.id ?? ''}">
        <div class="layui-form-item">
              <label class="layui-form-label">名称：</label>
              <div class="layui-input-inline">
                <input type="text" value="{$data.name ?? ''}" class="layui-input" name='name'>
              </div>
        </div>
        <div class="layui-form-item">
              <label class="layui-form-label">交易金额最低：</label>
              <div class="layui-input-inline">
                <input type="text" value="{$data.min ?? ''}" class="layui-input" name="min">
              </div>
        </div>
        <div class="layui-form-item">
              <label class="layui-form-label">交易金额最高：</label>
              <div class="layui-input-inline">
                <input type="text" value="{$data.max ?? ''}" class="layui-input" name="max">
              </div>
        </div>
        <div class="layui-form-item">
              <label class="layui-form-label">日交易次数：</label>
              <div class="layui-input-inline">
                <input type="text" value="{$data.days ?? ''}" class="layui-input" name="days">
              </div>
        </div>
        <div class="layui-form-item">
              <label class="layui-form-label">日收益比例：</label>
              <div class="layui-input-inline">
                <input type="text" value="{$data.rate ?? ''}" class="layui-input" name="rate">
              </div>
        </div>
        <div class="layui-form-item">
              <label class="layui-form-label">价格：</label>
              <div class="layui-input-inline">
                <input type="text" value="{$data.price ?? ''}" class="layui-input" name="price">
              </div>
        </div>
        <div class="layui-form-item">
              <label class="layui-form-label">总数：</label>
              <div class="layui-input-inline">
                <input type="text" value="{$data.total ?? ''}" class="layui-input" name="total">
              </div>
        </div>
        <div class="layui-form-item">
              <label class="layui-form-label">已售：</label>
              <div class="layui-input-inline">
                <input type="text" value="{$data.has ?? ''}" class="layui-input" name="has">
              </div>
        </div>
        <!-- div class="layui-form-item">
              <label class="layui-form-label">简介：</label>
              <div class="layui-input-inline">
                <input type="text" value="{$data.intro ?? ''}" class="layui-input" name="intro">
              </div>
        </div> -->

        <!-- div class="layui-form-item">
          <label class="layui-form-label">状态:</label>
          <div class="layui-input-block">
             {if condition="$data.status == 1"}
              <input type="checkbox" checked="" name="status" lay-skin="switch" lay-filter="switchTest" lay-text="开|关">
              {else /}
                <input type="checkbox" name="status" lay-skin="switch" lay-filter="switchTest" lay-text="开|关">
              {/if}           
          </div>
        </div>
         <div class="layui-form-item">
          <label class="layui-form-label">开关:</label>
          <div class="layui-input-block">
             {if condition="$data.is_open == 1"}
              <input type="checkbox" checked="" name="is_open" lay-skin="switch" lay-filter="switchTest" lay-text="开|关">
              {else /}
                <input type="checkbox" name="is_open" lay-skin="switch" lay-filter="switchTest" lay-text="开|关">
              {/if}           
          </div>
        </div> -->
        <div class="layui-form-item">
          <div class="layui-input-block">
            <button class="layui-btn" onclick="ajax()" lay-filter="formDemo">提交</button>
          </div>
        </div>
  </form>
</div>  
{/block}
{block name="script"}
<script type="text/javascript">
function ajax(el){
  var post_data = $("#edit_form").serialize();
  // post_data = post_data+'&el='+el;
  $.ajax({
      url:"{:url('admin/invest/editConfig')}",
      type:"POST",
      data:post_data,
      success:function(ret){
          if (ret.code == 0) {
            layer.msg('操作成功');
            window.parent.location.reload();
          }
          if (ret.code == 1) {
              layer.msg(ret.msg);
          }
      }
  });
}
</script> 
{/block}